package com.tanjiaming99.service;

import com.spring.*;

/**
 * @Author tanjiaming99.com
 * @Date 2021/12/14 21:24
 **/
@Component("userService")
//@Scope("prototype")
public class UserService implements BeanNameAware, InitializingBean {

    @Autowired
    private OrderService orderService;

    private String name;

    // 希望它能自动赋值
    private String beanName;

    public void test(){
        System.out.println(orderService );
        System.out.println("beanName:"+beanName);
    }

    @Override
    public void setBeanName(String name) {
        beanName = name;
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("afterPropertiesSet()，一个初始化的机制。。。");
    }

    public void setName(String name) {
        this.name = name;
    }
}
